import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { SupplierSelectionVO, SupplierSelectionForm, SupplierSelectionQuery } from '@/pagesA/api/workflow/supplierSelection/types';

/**
 * 查询供应商选定审批单列表
 * @param query
 * @returns {*}
 */

export const listSupplierSelection = (query?: SupplierSelectionQuery): AxiosPromise<SupplierSelectionVO[]> => {
  return request({
    url: '/workflow/supplierSelection/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询供应商选定审批单详细
 * @param id
 */
export const getSupplierSelection = (id: string | number): AxiosPromise<SupplierSelectionVO> => {
  return request({
    url: '/workflow/supplierSelection/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商选定审批单
 * @param data
 */
export const addSupplierSelection = (data: SupplierSelectionForm) => {
  return request({
    url: '/workflow/supplierSelection',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商选定审批单
 * @param data
 */
export const updateSupplierSelection = (data: SupplierSelectionForm) => {
  return request({
    url: '/workflow/supplierSelection',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商选定审批单
 * @param id
 */
export const delSupplierSelection = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/supplierSelection/' + id,
    method: 'delete'
  });
};
